Skip to content

Conversation

@jordancarlin
Copy link
Contributor

@jordancarlin jordancarlin commented Oct 30, 2025

Python, Node, and Ruby packages were all installed in the local workspace at runtime. This slows down initial runs and creates the potential for people to use different versions of packages (the Node lock file was not actually being used). It also creates permissions issues when switching between different container runtimes (I've been switching between Podman and the Devcontainer lately).

This installs the Python and Node packages in the container and updates the npm installation process to actually use package-lock.json.

I haven't tested with Singularity (I'm a Podman/Docker user), but everything is passing with Podman locally.

I'll follow up with another PR later to migrate some of the Ruby packages to the container as well, but that one is trickier because some of the Ruby packages are local to the UDB project.

@jordancarlin
Copy link
Contributor Author

Now tested locally with Singularity and the Devcontainer, and both are working.

@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.05%. Comparing base (e3fb9b1) to head (bf89b0d).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1220   +/-   ##
=======================================
  Coverage   46.05%   46.05%           
=======================================
  Files          11       11           
  Lines        4942     4942           
  Branches     1345     1345           
=======================================
  Hits         2276     2276           
  Misses       2666     2666           
Flag Coverage Δ
idlc 46.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@ThinkOpenly ThinkOpenly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing "RuntimeError". Using podman. You are apparently not seeing that, so I'm wondering what the differences are. With this history, I marked the commits that worked (OK) and didn't (KO):

KO: 6d546f8b571a (jordancarlin/install_deps, install_deps) update more node_module paths
    6da03ef3df1d Fix context in devcontainer
    1ec2d03e3ceb Move requirements.txt install location to work around Singularity clearing /tmp
    87c62f446142 update package-lock.json
    c03df7b9290d install npm packages in container
KO: 977232813d49 (HEAD) Install Python packages in container
OK: e3fb9b1f6178 feat: attempt to pull docker image before building it (#1218)
    7e6266dafd64 feat(data): add Zihintntl instructions (#1213)
OK: ea744dd24cc7 fix(typo): correct typo in Xqci extension description (#1214)

@jordancarlin
Copy link
Contributor Author

I'm seeing "RuntimeError". Using podman. You are apparently not seeing that, so I'm wondering what the differences are. With this history, I marked the commits that worked (OK) and didn't (KO):

KO: 6d546f8b571a (jordancarlin/install_deps, install_deps) update more node_module paths
    6da03ef3df1d Fix context in devcontainer
    1ec2d03e3ceb Move requirements.txt install location to work around Singularity clearing /tmp
    87c62f446142 update package-lock.json
    c03df7b9290d install npm packages in container
KO: 977232813d49 (HEAD) Install Python packages in container
OK: e3fb9b1f6178 feat: attempt to pull docker image before building it (#1218)
    7e6266dafd64 feat(data): add Zihintntl instructions (#1213)
OK: ea744dd24cc7 fix(typo): correct typo in Xqci extension description (#1214)

Hmm. I built the image and ran regression successfully with Podman, Singularity, and a Devcontainer. Can you include the actual error message and what exact command triggered it to help debug?

@ThinkOpenly
Copy link
Collaborator

Can you include the actual error message and what exact command triggered it to help debug?

jordancarlin$ ./do clean
jordancarlin$ ./do gen:resolved_arch
UDB tools run in a container. Docker, Podman, and Singularity/Apptainer are supported.

1. Docker
2. Podman
3. Singularity

Which would you like to use? (1/2/3) 
2
Using podman environment
Recreating bundle config...
Running with 1 job(s)
/opt/venv/bin/python3 /home/pc/projects/riscv/riscv-unified-db/jordancarlin/tools/ruby-gems/udb/python/yaml_resolver.py merge /home/pc/projects/riscv/riscv-unified-db/jordancarlin/spec/std/isa /does/not/exist /home/pc/projects/riscv/riscv-unified-db/jordancarlin/gen/spec/_
/home/pc/projects/riscv/riscv-unified-db/jordancarlin/tools/ruby-gems/udb/lib/udb/resolver.rb:174:in `run': RuntimeError
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/call_validation.rb:282:in `bind_call'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/call_validation.rb:282:in `validate_call'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/tools/ruby-gems/udb/lib/udb/resolver.rb:221:in `merge_arch'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/call_validation.rb:282:in `bind_call'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/call_validation.rb:282:in `validate_call'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/tools/ruby-gems/udb/lib/udb/resolver.rb:235:in `resolve_arch'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/call_validation.rb:282:in `bind_call'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/call_validation.rb:282:in `validate_call'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/tools/ruby-gems/udb/lib/udb/resolver.rb:303:in `cfg_arch_for'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/call_validation.rb:282:in `bind_call'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/call_validation.rb:282:in `validate_call'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/sorbet-runtime-0.5.12157/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/Rakefile:90:in `block (2 levels) in <top (required)>'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/task.rb:281:in `block in execute'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/task.rb:281:in `each'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/task.rb:281:in `execute'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/task.rb:199:in `synchronize'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/task.rb:199:in `invoke_with_call_chain'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/task.rb:188:in `invoke'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/application.rb:188:in `invoke_task'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/application.rb:138:in `block (2 levels) in top_level'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/application.rb:138:in `each'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/application.rb:138:in `block in top_level'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/application.rb:147:in `run_with_threads'
	from /home/pc/projects/riscv/riscv-unified-db/jordancarlin/.home/.gems/ruby/3.2.0/gems/rake-13.3.0/lib/rake/application.rb:132:in `top_level'
	from -e:1:in `<main>'

@ThinkOpenly
Copy link
Collaborator

BTW, I usually run a shell in a container, and that has additional things that are not available outside of the container, like "bundle":

$ ./do gen:resolved_arch
Using devcontainer environment
Recreating bundle config...
/home/pc/projects/riscv/riscv-unified-db/riscv-unified-db/bin/setup: line 183: bundle: command not found
/home/pc/projects/riscv/riscv-unified-db/riscv-unified-db/bin/setup: line 184: bundle: command not found
/home/pc/projects/riscv/riscv-unified-db/riscv-unified-db/bin/setup: line 185: bundle: command not found
./do: line 21: bundle: command not found

...maybe that's causing the issue here? If so, I wonder if the "fix" is that "bundle" needs to be installed somewhere in the setup scripts? (Do I need to install "bundle" outside of the container? That seems counter-intuitive to using the containers.)

@jordancarlin
Copy link
Contributor Author

Looking at the log you shared, I'm guessing it didn't actually rebuild the container. So you are running the new scripts that expect binaries in different places, but your container still has them in the old places. I'll look into why that might be happening, but in the meantime you could probably work around it by removing the old image (podman image prune ...).

@jordancarlin
Copy link
Contributor Author

I didn't bump the container version that it was looking for, so I think it pulled the existing v0.9 image from Docker Hub. Just pushed another commit that increases the container version to 0.10, so hopefully it will now detect that there is no compatible image on Docker Hub and will build the image itself locally. Once we merge this, it looks like there is a CI job that will publish the new version to Docker Hub.

@ThinkOpenly can you test again with the latest version?

@ThinkOpenly
Copy link
Collaborator

@ThinkOpenly can you test again with the latest version?

It worked with that change. 🎉

@jordancarlin
Copy link
Contributor Author

Once we merge this, it looks like there is a CI job that will publish the new version to Docker Hub.

It looks like the last couple runs of the image publish job failed for unrelated reasons: https://github.com/riscv-software-src/riscv-unified-db/actions/workflows/container.yml.

We need to get that resolved before merging this, otherwise the new image won't be available to users.

@ThinkOpenly
Copy link
Collaborator

It looks like the last couple runs of the image publish job failed for unrelated reasons: https://github.com/riscv-software-src/riscv-unified-db/actions/workflows/container.yml.

We need to get that resolved before merging this, otherwise the new image won't be available to users.

The failures appear to have been intermittent. It failed trying to download/install packages, so perhaps a network glitch. I restarted the first failure, and it completed successfully. I have restarted the 2nd, but I expect the same.

@ThinkOpenly ThinkOpenly added this pull request to the merge queue Oct 31, 2025
Merged via the queue into riscv-software-src:main with commit cbee0b7 Oct 31, 2025
47 checks passed
@jordancarlin jordancarlin deleted the install_deps branch October 31, 2025 04:30
ENV PATH="/opt/venv/bin:$PATH"

# Install npm packages globally in the container
COPY package.json package-lock.json /opt/node/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the npm install happening in the container now, shouldn't we drop package-lock.json from the repo entirely? It's not going to be kept up to date since npm no longer runs at the root

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm installing packages using npm ci right now, which uses the versions from package-lock.json. We were previously using npm i which didn't actually fix the versions. I'd be in favor of marinating the lock file so that all of the dependencies are clear.

It might make sense to enable Dependabot for npm packages so that we get automatically get PRs to bump them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants